package com.xueke.crawler.service.initTree;

import com.xueke.crawler.dao.SubjectTreeMapper;
import com.xueke.crawler.model.SubjectTree;
import com.xueke.crawler.service.AbstractBaseService;
import com.xueke.crawler.service.Start;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by weibo on 2017/5/13.
 *
 * @author weibo.qin
 * @version 2017/5/13
 */
public abstract class BaseInitTree extends AbstractBaseService implements Start {

    @Autowired
    protected SubjectTreeMapper subjectTreeMapper;

    protected void saveSubjectTree(String channelId, String dataId, String domain, String uri, String title, String pid, int
        isLeaf, String dataType) {
        SubjectTree subjectTree = new SubjectTree();
        subjectTree.setCid(Integer.valueOf(channelId));
        subjectTree.setNid(Integer.valueOf(dataId));
        subjectTree.setDomain(domain);
        subjectTree.setUri(uri);
        subjectTree.setTitle(title);
        subjectTree.setPnid(Integer.valueOf(pid));
        subjectTree.setIsDeaf(isLeaf);
        subjectTree.setDataType(dataType);

        subjectTreeMapper.insertSubjectTree(subjectTree);
    }

}
